Introduce TF_LDFLAGS
authorDouglas Raillard <[email protected]>
Thu, 22 Jun 2017 13:44:48 +0000 (14:44 +0100)
committerDouglas Raillard <[email protected]>
Wed, 28 Jun 2017 14:03:05 +0000 (15:03 +0100)
Use TF_LDFLAGS from the Makefiles, and still append LDFLAGS as well to
the compiler's invocation. This allows passing extra options from the
make command line using LDFLAGS.

Document new LDFLAGS Makefile option.

Change-Id: I88c5ac26ca12ac2b2d60a6f150ae027639991f27
Signed-off-by: Douglas Raillard <[email protected]>
Makefile
docs/user-guide.md
lib/cpus/cpu-ops.mk
make_helpers/build_macros.mk

index 91f7c9272604a65ed2f6def87e6cfc7dd43a4f55..b9805c77e0a4bb4a47a3976c802e4872b715ccce 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -151,10 +151,9 @@ TF_CFLAGS          +=      $(CPPFLAGS) $(TF_CFLAGS_$(ARCH))                \
                                -ffreestanding -fno-builtin -Wall -std=gnu99    \
                                -Os -ffunction-sections -fdata-sections
 
-LDFLAGS                        +=      $(LDFLAGS_$(ARCH))
-LDFLAGS                        +=      --fatal-warnings -O1
-LDFLAGS                        +=      --gc-sections
-
+TF_LDFLAGS             +=      --fatal-warnings -O1
+TF_LDFLAGS             +=      --gc-sections
+TF_LDFLAGS             +=      $(TF_LDFLAGS_$(ARCH))
 
 ################################################################################
 # Common sources and include directories
index 1a07954afae6d16eab9202eb55caf679794bd662..0e9da35d615927cf7e4b83bac2903cee6ba7c0be 100644 (file)
@@ -385,6 +385,9 @@ performed.
     AArch64 and facilitates the loading of `SP_MIN` and BL33 as AArch32 executable
     images.
 
+*   `LDFLAGS`: Extra user options appended to the linkers' command line in
+    addition to the one set by the build system.
+
 *   `LOAD_IMAGE_V2`: Boolean option to enable support for new version (v2) of
     image loading, which provides more flexibility and scalability around what
     images are loaded and executed during boot. Default is 0.
index 218a5482fe70020e0198bed5357bb613f3f58ad9..ad3297196ba3c1b07ceb4b310df5b6bdbd369fba 100644 (file)
@@ -145,10 +145,10 @@ $(eval $(call add_define,ERRATA_A57_833471))
 
 # Errata build flags
 ifneq (${ERRATA_A53_843419},0)
-LDFLAGS_aarch64                += --fix-cortex-a53-843419
+TF_LDFLAGS_aarch64     += --fix-cortex-a53-843419
 endif
 
 ifneq (${ERRATA_A53_835769},0)
 TF_CFLAGS_aarch64      += -mfix-cortex-a53-835769
-LDFLAGS_aarch64                += --fix-cortex-a53-835769
+TF_LDFLAGS_aarch64     += --fix-cortex-a53-835769
 endif
index 34d82c9a373c7b06ccd31d66f4ccbba205373642..aee045dee8d2bbee396202c83e6c178c75048999 100644 (file)
@@ -313,8 +313,8 @@ else
               const char version_string[] = "${VERSION_STRING}";' | \
                $$(CC) $$(TF_CFLAGS) $$(CFLAGS) -xc -c - -o $(BUILD_DIR)/build_message.o
 endif
-       $$(Q)$$(LD) -o $$@ $$(LDFLAGS) -Map=$(MAPFILE) --script $(LINKERFILE) \
-                                       $(BUILD_DIR)/build_message.o $(OBJS)
+       $$(Q)$$(LD) -o $$@ $$(TF_LDFLAGS) $$(LDFLAGS) -Map=$(MAPFILE) \
+               --script $(LINKERFILE) $(BUILD_DIR)/build_message.o $(OBJS)
 
 $(DUMP): $(ELF)
        @echo "  OD      $$@"